// pages/selected_server/select_ser.js
var app = getApp();
var that
Page({
  data: {
    h: 0,
    service:null,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    that=this
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          h: res.windowHeight
        });
      }
    });
    that.get_service_msg();//获取服务项目
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  adv_order:function(){
    wx.navigateBack({     //点击下单 返回到上一界面
      delta: 1
    })
  },
  get_service_msg: function () {  //获取酒店所有信息
    app.req("get_service.html", {}, function (res) {
      if (res.status == "success") {
        for (var i = 0; i < res.mess.length; i++) {
          if (res.mess[i].time != 0) {
            res.mess[i].time = "-" + res.mess[i].time + "分钟"
          } else { res.mess[i].time = "" }
          if (res.mess[i].type == 1) {
            res.mess[i].type = "非托养单猫：" + res.mess[i].price * 1.5
          } else { res.mess[i].type = "不对非托养猫开放" }
        }
        that.setData({ service: res.mess });
      } else if (res.status == "error") {
        app.toast(res.mess)
      } else {
        app.modal("错误提示", "网络错误，是否重试？", function (re) {
          if (re) {
            that.get_service_msg()
          }
        })
      }
    })
  },
})